import Vue from 'vue'
import VueRouter from 'vue-router'

import UserView from '@/views/user/UserView.vue'

import LoginView from '@/views/LoginView.vue'
import RecordsView from '@/views/user/RecordsView.vue'
import HomePageView from '@/views/user/HomePageView.vue'
import HomeView from '@/views/HomeView.vue'
import ServiceView from '@/views/user/ServiceView.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView, // 使用 LoginLayout 组件作为登录页面的布局  
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView, // 使用 MainLayout 组件作为主内容的布局  
    children: [
      {
        path: '/',
        redirect: '/homepage' // 默认跳转到首页  
      },
      {
        path: '/homepage',
        name: 'homepage',
        component: HomePageView,
      },
      {
        path: '/service',
        name: 'service',
        component: ServiceView,
      },
      {
        path: '/records',
        name: 'records',
        component: RecordsView, //交易记录
      },
      {
        path: '/user',
        name: 'user',
        component: UserView, // 使用 LoginLayout 组件作为登录页面的布局  
      },
  

      // 其他需要渲染在 MainLayout <router-view /> 中的路由...  
    ]
  }
  // 其他路由... 
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
